<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8"/>
    <meta content="IE=9; IE=8; IE=7; IE=EDGE" http-equiv="X-UA-Compatible">
    <meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible"/>
    <title>我的购物车</title>

    <link href="/static/cart/css/webbase.css" rel="stylesheet" type="text/css"/>
    <link href="/static/cart/css/pages-cart.css" rel="stylesheet" type="text/css"/>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <script th:inline="javascript">
        //0. 得到购物车列表
        let cartList = [[${cartList}]];

        //1. 添加购物车
        function addCart(itemId, num) {
            console.log(itemId, num)
            location.href = `/addCart?itemId=${itemId}&num=${num}`
        }

        //2. 窗口加载完毕就计算商品总数及总金额
        $(function () {
            calcCart();
        })

        function calcCart() {
            //2.1 定义商品数量
            let num = 0;
            //2.2 定义商品总金额
            let money = 0;
            //2.3 遍历购物车
            cartList.forEach(cart => {
                cart.orderItemList.forEach(item => {
                    num += parseInt(item.num);						//累加商品数量
                    money += parseFloat(item.totalFee.toFixed(2));  //转换为小数
                })
            })
            //2.4 为数量及金额赋值
            $("#cartnum").html(num);
            $("#cartmoney").html(money);
        }
    </script>

</head>

<body>

<!--head-->
<div class="top">
    <div class="py-container">
        <div class="shortcut">
            <ul class="fl">
                <li class="f-item">泽易购欢迎您！</li>
                <li class="f-item">请登录　<span><a href="#">免费注册</a></span></li>
            </ul>
            <ul class="fr">
                <li class="f-item">我的订单</li>
                <li class="f-item space"></li>
                <li class="f-item">我的泽易购</li>
                <li class="f-item space"></li>
                <li class="f-item">泽易购会员</li>
                <li class="f-item space"></li>
                <li class="f-item">企业采购</li>
                <li class="f-item space"></li>
                <li class="f-item">关注泽易购</li>
                <li class="f-item space"></li>
                <li class="f-item">客户服务</li>
                <li class="f-item space"></li>
                <li class="f-item">网站导航</li>
            </ul>
        </div>
    </div>
</div>
<div class="cart py-container">
    <!--logoArea-->
    <div class="logoArea">
        <div class="fl logo"><span class="title">购物车</span></div>
        <div class="fr search">
            <form class="sui-form form-inline">
                <div class="input-append">
                    <input class="input-error input-xxlarge" placeholder="泽易购自营" type="text"/>
                    <button class="sui-btn btn-xlarge btn-danger" type="button">搜索</button>
                </div>
            </form>
        </div>
    </div>
    <!--All goods-->
    <div class="allgoods">
        <h4>全部商品<span>11</span></h4>
        <div class="cart-main">
            <div class="yui3-g cart-th">
                <div class="yui3-u-1-4"><input id="" name="" type="checkbox" value=""/> 全部</div>
                <div class="yui3-u-1-4">商品</div>
                <div class="yui3-u-1-8">单价（元）</div>
                <div class="yui3-u-1-8">数量</div>
                <div class="yui3-u-1-8">小计（元）</div>
                <div class="yui3-u-1-8">操作</div>
            </div>
            <div class="cart-item-list" th:each="cart : ${cartList}">
                <div class="cart-shop">
                    <input type="checkbox"/>
                    <span class="shopname self">[[${cart.sellerName}]]</span>
                </div>
                <div class="cart-body">
                    <div class="cart-list" th:each="item : ${cart.orderItemList}">
                        <ul class="goods-list yui3-g">
                            <li class="yui3-u-1-24">
                                <input id="" name="" type="checkbox" value=""/>
                            </li>
                            <li class="yui3-u-11-24">
                                <div class="good-item">
                                    <div class="item-img">
                                        <img th:src="${item.picPath}"/>
                                    </div>
                                    <div class="item-msg">[[${item.title}]]</div>
                                </div>
                            </li>

                            <li class="yui3-u-1-8"><span class="price">[[${item.price}]]</span></li>
                            <li class="yui3-u-1-8">
                                <a class="increment mins" href="javascript:void(0)"
                                   th:onclick="|addCart('${item.itemId}','-1')|">-</a>
                                <input autocomplete="off" class="itxt" minnum="1" th:value="${item.num}" type="text"/>
                                <a class="increment plus" href="javascript:void(0)"
                                   th:onclick="|addCart('${item.itemId}','1')|">+</a>
                            </li>
                            <li class="yui3-u-1-8"><span
                                    class="sum">[[${#numbers.formatDecimal(item.totalFee,1,2)}]]</span></li>
                            <li class="yui3-u-1-8">
                                <a href="#">删除</a><br/>
                                <a href="#">移到我的关注</a>
                            </li>
                        </ul>
                    </div>

                </div>
            </div>

        </div>
        <div class="cart-tool">
            <div class="select-all">
                <input id="" name="" type="checkbox" value=""/>
                <span>全选</span>
            </div>
            <div class="option">
                <a href="#">删除选中的商品</a>
                <a href="#">移到我的关注</a>
                <a href="#">清除下柜商品</a>
            </div>
            <div class="toolbar">
                <div class="chosed">已选择<span id="cartnum">0</span>件商品</div>
                <div class="sumprice">
                    <span><em>总价（不含运费） ：</em><i class="summoney" id="cartmoney">¥16283.00</i></span>
                    <span><em>已节省：</em><i>-¥20.00</i></span>
                </div>
                <div class="sumbtn">
                    <a class="sum-btn" href="/static/cart/getOrderInfo.html" target="_blank">结算</a>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
        <div class="deled">
            <span>已删除商品，您可以重新购买或加关注：</span>
            <div class="cart-list del">
                <ul class="goods-list yui3-g">
                    <li class="yui3-u-1-2">
                        <div class="good-item">
                            <div class="item-msg">Apple Macbook Air 13.3英寸笔记本电脑 银色（Corei5）处理器/8GB内存</div>
                        </div>
                    </li>
                    <li class="yui3-u-1-6"><span class="price">8848.00</span></li>
                    <li class="yui3-u-1-6">
                        <span class="number">1</span>
                    </li>
                    <li class="yui3-u-1-8">
                        <a href="#">重新购买</a>
                        <a href="#">移到我的关注</a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="liked">
            <ul class="sui-nav nav-tabs">
                <li class="active">
                    <a data-toggle="tab" href="#index">猜你喜欢</a>
                </li>
                <li>
                    <a data-toggle="tab" href="#profile">特惠换购</a>
                </li>
            </ul>
            <div class="clearfix"></div>
            <div class="tab-content">
                <div class="tab-pane active" id="index">
                    <div class="sui-carousel slide" data-interval="4000" data-ride="carousel" id="myCarousel">
                        <div class="carousel-inner">
                            <div class="active item">
                                <ul>
                                    <li>
                                        <img src="/static/cart/img/like1.png"/>
                                        <div class="intro">
                                            <i>Apple苹果iPhone 6s (A1699)</i>
                                        </div>
                                        <div class="money">
                                            <span>$29.00</span>
                                        </div>
                                        <div class="incar">
                                            <a class="sui-btn btn-bordered btn-xlarge btn-default" href="#"><i
                                                    class="car"></i><span class="cartxt">加入购物车</span></a>
                                        </div>
                                    </li>
                                    <li>
                                        <img src="/static/cart/img/like2.png"/>
                                        <div class="intro">
                                            <i>Apple苹果iPhone 6s (A1699)</i>
                                        </div>
                                        <div class="money">
                                            <span>$29.00</span>
                                        </div>
                                        <div class="incar">
                                            <a class="sui-btn btn-bordered btn-xlarge btn-default" href="#"><i
                                                    class="car"></i><span class="cartxt">加入购物车</span></a>
                                        </div>
                                    </li>
                                    <li>
                                        <img src="/static/cart/img/like3.png"/>
                                        <div class="intro">
                                            <i>Apple苹果iPhone 6s (A1699)</i>
                                        </div>
                                        <div class="money">
                                            <span>$29.00</span>
                                        </div>
                                        <div class="incar">
                                            <a class="sui-btn btn-bordered btn-xlarge btn-default" href="#"><i
                                                    class="car"></i><span class="cartxt">加入购物车</span></a>
                                        </div>
                                    </li>
                                    <li>
                                        <img src="/static/cart/img/like4.png"/>
                                        <div class="intro">
                                            <i>Apple苹果iPhone 6s (A1699)</i>
                                        </div>
                                        <div class="money">
                                            <span>$29.00</span>
                                        </div>
                                        <div class="incar">
                                            <a class="sui-btn btn-bordered btn-xlarge btn-default" href="#"><i
                                                    class="car"></i><span class="cartxt">加入购物车</span></a>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                            <div class="item">
                                <ul>
                                    <li>
                                        <img src="/static/cart/img/like1.png"/>
                                        <div class="intro">
                                            <i>Apple苹果iPhone 6s (A1699)</i>
                                        </div>
                                        <div class="money">
                                            <span>$29.00</span>
                                        </div>
                                        <div class="incar">
                                            <a class="sui-btn btn-bordered btn-xlarge btn-default" href="#"><i
                                                    class="car"></i><span class="cartxt">加入购物车</span></a>
                                        </div>
                                    </li>
                                    <li>
                                        <img src="/static/cart/img/like2.png"/>
                                        <div class="intro">
                                            <i>Apple苹果iPhone 6s (A1699)</i>
                                        </div>
                                        <div class="money">
                                            <span>$29.00</span>
                                        </div>
                                        <div class="incar">
                                            <a class="sui-btn btn-bordered btn-xlarge btn-default" href="#"><i
                                                    class="car"></i><span class="cartxt">加入购物车</span></a>
                                        </div>
                                    </li>
                                    <li>
                                        <img src="/static/cart/img/like3.png"/>
                                        <div class="intro">
                                            <i>Apple苹果iPhone 6s (A1699)</i>
                                        </div>
                                        <div class="money">
                                            <span>$29.00</span>
                                        </div>
                                        <div class="incar">
                                            <a class="sui-btn btn-bordered btn-xlarge btn-default" href="#"><i
                                                    class="car"></i><span class="cartxt">加入购物车</span></a>
                                        </div>
                                    </li>
                                    <li>
                                        <img src="/static/cart/img/like4.png"/>
                                        <div class="intro">
                                            <i>Apple苹果iPhone 6s (A1699)</i>
                                        </div>
                                        <div class="money">
                                            <span>$29.00</span>
                                        </div>
                                        <div class="incar">
                                            <a class="sui-btn btn-bordered btn-xlarge btn-default" href="#"><i
                                                    class="car"></i><span class="cartxt">加入购物车</span></a>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <a class="carousel-control left" data-slide="prev" href="#myCarousel">‹</a>
                        <a class="carousel-control right" data-slide="next" href="#myCarousel">›</a>
                    </div>
                </div>
                <div class="tab-pane" id="profile">
                    <p>特惠选购</p>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 底部栏位 -->
<!--页面底部-->
<div class="clearfix footer">
    <div class="py-container">
        <div class="footlink">
            <div class="Mod-service">
                <ul class="Mod-Service-list">
                    <li class="grid-service-item intro  intro1">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                    <li class="grid-service-item  intro intro2">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                    <li class="grid-service-item intro  intro3">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                    <li class="grid-service-item  intro intro4">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                    <li class="grid-service-item intro intro5">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                </ul>
            </div>
            <div class="clearfix Mod-list">
                <div class="yui3-g">
                    <div class="yui3-u-1-6">
                        <h4>购物指南</h4>
                        <ul class="unstyled">
                            <li>购物流程</li>
                            <li>会员介绍</li>
                            <li>生活旅行/团购</li>
                            <li>常见问题</li>
                            <li>购物指南</li>
                        </ul>

                    </div>
                    <div class="yui3-u-1-6">
                        <h4>配送方式</h4>
                        <ul class="unstyled">
                            <li>上门自提</li>
                            <li>211限时达</li>
                            <li>配送服务查询</li>
                            <li>配送费收取标准</li>
                            <li>海外配送</li>
                        </ul>
                    </div>
                    <div class="yui3-u-1-6">
                        <h4>支付方式</h4>
                        <ul class="unstyled">
                            <li>货到付款</li>
                            <li>在线支付</li>
                            <li>分期付款</li>
                            <li>邮局汇款</li>
                            <li>公司转账</li>
                        </ul>
                    </div>
                    <div class="yui3-u-1-6">
                        <h4>售后服务</h4>
                        <ul class="unstyled">
                            <li>售后政策</li>
                            <li>价格保护</li>
                            <li>退款说明</li>
                            <li>返修/退换货</li>
                            <li>取消订单</li>
                        </ul>
                    </div>
                    <div class="yui3-u-1-6">
                        <h4>特色服务</h4>
                        <ul class="unstyled">
                            <li>夺宝岛</li>
                            <li>DIY装机</li>
                            <li>延保服务</li>
                            <li>泽易购E卡</li>
                            <li>泽易购通信</li>
                        </ul>
                    </div>
                    <div class="yui3-u-1-6">
                        <h4>帮助中心</h4>
                        <img src="/static/cart/img/wx_cz.jpg">
                    </div>
                </div>
            </div>
            <div class="Mod-copyright">
                <ul class="helpLink">
                    <li>关于我们<span class="space"></span></li>
                    <li>联系我们<span class="space"></span></li>
                    <li>关于我们<span class="space"></span></li>
                    <li>商家入驻<span class="space"></span></li>
                    <li>营销中心<span class="space"></span></li>
                    <li>友情链接<span class="space"></span></li>
                    <li>关于我们<span class="space"></span></li>
                    <li>营销中心<span class="space"></span></li>
                    <li>友情链接<span class="space"></span></li>
                    <li>关于我们</li>
                </ul>
                <p>地址：深圳市大冲国际</p>
                <p>深ICP备08011423号深公网安备1111098079901</p>
            </div>
        </div>
    </div>
</div>
<!--页面底部END-->

<script src="/static/cart/js/plugins/jquery/jquery.min.js" type="text/javascript"></script>
<script src="/static/cart/js/plugins/jquery.easing/jquery.easing.min.js" type="text/javascript"></script>
<script src="/static/cart/js/plugins/sui/sui.min.js" type="text/javascript"></script>
<script src="/static/cart/js/widget/nav.js" type="text/javascript"></script>
</body>

</html>